module lang.d.sts.expressions.dsliceexpression;

import lang.d.sts.expressions.dexpression;
import lang.d.visitors.dvisitor;

class DSliceExpression: DExpression {
    private DExpression myPrimaryExpression;
    private DExpression myStartIndex;
    private DExpression myEndIndex;

    public this(DExpression primaryExpression, DExpression start = null, DExpression end = null) {
        myPrimaryExpression = primaryExpression;
        primaryExpression.setParent(this);
        myStartIndex = start;
        if (start) {
            start.setParent(this);
        }
        myEndIndex = end;
        if (end) {
            end.setParent(this);
        }
    }

    public DExpression getPrimaryExpression() {
        return myPrimaryExpression;
    }

    public DExpression getStart() {
        return myStartIndex;
    }

    public DExpression getEnd() {
        return myEndIndex;
    }

    override public void accept(DVisitor visitor) {
        visitor.visitSliceExpression(this);
    }
}

